<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Recording Surfaces</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
<link rel="up" href="cairo-surfaces.html" title="Surfaces">
<link rel="prev" href="cairo-PostScript-Surfaces.html" title="PostScript Surfaces">
<link rel="next" href="cairo-Win32-Surfaces.html" title="Win32 Surfaces">
<meta name="generator" content="GTK-Doc V1.15 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="cairo-PostScript-Surfaces.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="cairo-surfaces.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
<td><a accesskey="n" href="cairo-Win32-Surfaces.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#cairo-Recording-Surfaces.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#cairo-Recording-Surfaces.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" title="Recording Surfaces">
<a name="cairo-Recording-Surfaces"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="cairo-Recording-Surfaces.top_of_page"></a>Recording Surfaces</span></h2>
<p>Recording Surfaces — Records all drawing operations</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv" title="Synopsis">
<a name="cairo-Recording-Surfaces.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">#define             <a class="link" href="cairo-Recording-Surfaces.html#CAIRO-HAS-RECORDING-SURFACE:CAPS" title="CAIRO_HAS_RECORDING_SURFACE">CAIRO_HAS_RECORDING_SURFACE</a>
<a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="returnvalue">cairo_surface_t</span></a> *   <a class="link" href="cairo-Recording-Surfaces.html#cairo-recording-surface-create" title="cairo_recording_surface_create ()">cairo_recording_surface_create</a>      (<em class="parameter"><code><a class="link" href="cairo-cairo-surface-t.html#cairo-content-t" title="enum cairo_content_t"><span class="type">cairo_content_t</span></a> content</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cairo-cairo-t.html#cairo-rectangle-t" title="cairo_rectangle_t"><span class="type">cairo_rectangle_t</span></a> *extents</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="cairo-Recording-Surfaces.html#cairo-recording-surface-ink-extents" title="cairo_recording_surface_ink_extents ()">cairo_recording_surface_ink_extents</a> (<em class="parameter"><code><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> *surface</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> *x0</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> *y0</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> *width</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> *height</code></em>);
</pre>
</div>
<div class="refsect1" title="Description">
<a name="cairo-Recording-Surfaces.description"></a><h2>Description</h2>
<p>
A recording surface is a surface that records all drawing operations at
the highest level of the surface backend interface, (that is, the
level of paint, mask, stroke, fill, and show_text_glyphs). The recording
surface can then be "replayed" against any target surface by using it
as a source surface.
</p>
<p>
If you want to replay a surface so that the results in target will be
identical to the results that would have been obtained if the original
operations applied to the recording surface had instead been applied to the
target surface, you can use code like this:
</p>
<div class="informalexample"><pre class="programlisting">
     cairo_t *cr;

cr = cairo_create (target);
cairo_set_source_surface (cr, recording_surface, 0.0, 0.0);
cairo_paint (cr);
cairo_destroy (cr);
</pre></div>
<p>
</p>
<p>
A recording surface is logically unbounded, i.e. it has no implicit constraint
on the size of the drawing surface. However, in practice this is rarely
useful as you wish to replay against a particular target surface with
known bounds. For this case, it is more efficient to specify the target
extents to the recording surface upon creation.
</p>
<p>
The recording phase of the recording surface is careful to snapshot all
necessary objects (paths, patterns, etc.), in order to achieve
accurate replay. The efficiency of the recording surface could be
improved by improving the implementation of snapshot for the
various objects. For example, it would be nice to have a
copy-on-write implementation for _cairo_surface_snapshot.
</p>
</div>
<div class="refsect1" title="Details">
<a name="cairo-Recording-Surfaces.details"></a><h2>Details</h2>
<div class="refsect2" title="CAIRO_HAS_RECORDING_SURFACE">
<a name="CAIRO-HAS-RECORDING-SURFACE:CAPS"></a><h3>CAIRO_HAS_RECORDING_SURFACE</h3>
<pre class="programlisting">#define CAIRO_HAS_RECORDING_SURFACE 1
</pre>
<p>
Defined if the recording surface backend is available.
The recording surface backend is always built in.
This macro was added for completeness in cairo 1.10.
</p>
<p class="since">Since 1.10</p>
</div>
<hr>
<div class="refsect2" title="cairo_recording_surface_create ()">
<a name="cairo-recording-surface-create"></a><h3>cairo_recording_surface_create ()</h3>
<pre class="programlisting"><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="returnvalue">cairo_surface_t</span></a> *   cairo_recording_surface_create      (<em class="parameter"><code><a class="link" href="cairo-cairo-surface-t.html#cairo-content-t" title="enum cairo_content_t"><span class="type">cairo_content_t</span></a> content</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="cairo-cairo-t.html#cairo-rectangle-t" title="cairo_rectangle_t"><span class="type">cairo_rectangle_t</span></a> *extents</code></em>);</pre>
<p>
Creates a recording-surface which can be used to record all drawing operations
at the highest level (that is, the level of paint, mask, stroke, fill
and show_text_glyphs). The recording surface can then be "replayed" against
any target surface by using it as a source to drawing operations.
</p>
<p>
The recording phase of the recording surface is careful to snapshot all
necessary objects (paths, patterns, etc.), in order to achieve
accurate replay.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>content</code></em> :</span></p></td>
<td>the content of the recording surface
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>extents</code></em> :</span></p></td>
<td>the extents to record in pixels, can be <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to record
          unbounded operations.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a pointer to the newly created surface. The caller
owns the surface and should call <a class="link" href="cairo-cairo-surface-t.html#cairo-surface-destroy" title="cairo_surface_destroy ()"><code class="function">cairo_surface_destroy()</code></a> when done
with it.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.10</p>
</div>
<hr>
<div class="refsect2" title="cairo_recording_surface_ink_extents ()">
<a name="cairo-recording-surface-ink-extents"></a><h3>cairo_recording_surface_ink_extents ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                cairo_recording_surface_ink_extents (<em class="parameter"><code><a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a> *surface</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> *x0</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> *y0</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> *width</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> *height</code></em>);</pre>
<p>
Measures the extents of the operations stored within the recording-surface.
This is useful to compute the required size of an image surface (or
equivalent) into which to replay the full sequence of drawing operations.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td>a <span class="type">cairo_recording_surface_t</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x0</code></em> :</span></p></td>
<td>the x-coordinate of the top-left of the ink bounding box
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y0</code></em> :</span></p></td>
<td>the y-coordinate of the top-left of the ink bounding box
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td>the width of the ink bounding box
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td>the height of the ink bounding box
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.10</p>
</div>
</div>
<div class="refsect1" title="See Also">
<a name="cairo-Recording-Surfaces.see-also"></a><h2>See Also</h2>
<a class="link" href="cairo-cairo-surface-t.html#cairo-surface-t" title="cairo_surface_t"><span class="type">cairo_surface_t</span></a>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.15</div>
</body>
</html>